<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a,b,c,t=0;
        for(var i=100;i<1000;i++)
        {
            a=parseInt(i/100);
            b=parseInt(i/10%10);
            c=parseInt(i%10);
            if(Math.abs(a-b)<=1&&Math.abs(b-c)<=1)
            {
                t++;
            }
        }
        console.log(t);
    </script>
</body>
</html>